<template>
  <div>
    <el-table :data="tableData" stripe style="width: 100%" max-height="700">
      <el-table-column prop="name" label="名称"> </el-table-column>
      <el-table-column prop="auditStatus" label="审核状态">
        <template slot-scope="scope">
          <span v-show="scope.row.auditStatus == 1">待审核</span>
          <span class="color-success" v-show="scope.row.auditStatus == 2"
            >审核通过</span
          >
          <span class="color-danger" v-show="scope.row.auditStatus == 3"
            >不通过</span
          >
        </template>
      </el-table-column>
      <!-- <el-table-column prop="resultDes" label="审核备注">
        <template slot-scope="scope">
          <span>{{ scope.row.resultDes || "--" }}</span>
        </template>
      </el-table-column> -->
      <el-table-column prop="content" label="内容">
        <template slot-scope="scope">
          <p class="sheng ideological-content" :title="scope.row.content || ''">
            {{ scope.row.content || "--" }}
          </p>
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="创建时间"> </el-table-column>
      <el-table-column label="操作" width="220">
        <template slot-scope="{ row }">
          <el-button-group>
            <el-button type="custom" size="mini" @click="handleAudit(row)">
              审核
            </el-button>
          </el-button-group>
          <el-button-group>
            
          </el-button-group>
        </template>
      </el-table-column>
      <div slot="empty" class="emptyBg">
        <el-empty :image-size="200"></el-empty>
      </div>
    </el-table>
    <Pagination
      v-show="parseInt(pageObj.count) > 0"
      :total="parseInt(pageObj.count)"
      @change="getList"
      :page.sync="listQuery.page"
      :limit.sync="listQuery.limit"
    />
  </div>
</template>

<script>
import { sysIdeologicalEducationQuery } from "@/api/admin/system/sysIdeologicalEducation.js";
import Bus from "@/utils/bus.js";
import webinfo from "@/mixins/webinfo.js";
export default {
  mixins: [webinfo],
  data() {
    return {
      listQuery: {
        page: 1,
        limit: 10,
        type: 3,
        auditStatus: 1,
      },
      tableData: [],
      pageObj: {},
    };
  },
  mounted() {
    this.getList();
    Bus.$on("refreshIdeologicalAuditList", (v) => {
      if (v) {
        Object.assign(this.listQuery, v);
      }
      this.getList();
    });
  },
  beforeDestroy() {
    Bus.$off("refreshIdeologicalAuditList");
  },
  methods: {
    getList() {
      sysIdeologicalEducationQuery(this.listQuery).then((res) => {
        this.tableData = res.data.data;
        this.pageObj = res.data;
      });
    },
    //审核
    handleAudit(row) {
      Bus.$emit("showDialogIdeologicalAudit", row);
    },
  },
};
</script>
<style scoped>
.ideological-content {
  max-width: 300px;
}
</style>